package com.bookstore.dao.imp;

import com.bookstore.bean.Account;
import com.bookstore.dao.AccountDao;

/**
 * Created by Admin on 2016/8/22.
 */
public class AccountDaoImp extends BaseDao<Account> implements AccountDao {
    @Override
    public Account get(Integer accountId) {
        String sql = "select accountId,balance from account where accountId=?";
        return get(sql, accountId);
    }

    @Override
    public void updateBalance(Integer accountId, int amount) {
        String sql = "update account set balance=balance-? where accountId=? ";
        update(sql, amount, accountId);
    }
}
